import React, { Component } from 'react';
// 导入css文件
import '../../styles/index/MySeckill.css'
// 封装请求
import { index_goodlist } from '../../api/index'

class MySeckill extends Component {
    // 模拟数据
    constructor(props) {
        super(props);
        this.state = {
            list: [
            ]
        }
    }

    //    请求推荐列表数据
    componentDidMount(){
        index_goodlist().then((res)=>{
            // console.log(res.data.list);
            this.setState({list:res.data.list})
        })
    }

    render() {
        return (
            <div>
                <span className='buy'>今日值得买</span>
                <div className="seckill">
                    {
                        this.state.list.map((item, index) => {
                            return (
                                <div className="seckill-one" key={index}>
                                    <img src={item.pic} alt="" />
                                    <span className='tit'>{item.name}</span>
                                    <p>原价￥{item.salesPrice.value}</p>
                                    {/* <p>抢购价{item.rushBuy}</p> */}
                                </div>
                            )
                        })
                    }
                </div>
            </div>
        );
    }
}

export default MySeckill;